#+_+ coding:utf-8 +_+

from tornado.web import RequestHandler
from base import mpproxy 

class RootHdl(RequestHandler):

    def get(self):
        """ for wx's check our server """
        reqData = dict()
        reqData["signature"] = self.get_argument("signature",None)
        reqData["timestamp"] = self.get_argument("timestamp",None)
        reqData["nonce"]     = self.get_argument("nonce",None)
        reqData["echostr"]   = self.get_argument("echostr",None)

        rst  = mpproxy.DealWXSniff(reqData)
        self.write(rst)

    def post(self):
        """ for wx proxy message """
        reqData = self.request.body.strip()
        rst = mpproxy.DealClientMessage(reqData)
        self.write(rst)
